//
//  LGRuntime.m
//  SportRing
//
//  Created by mykoma on 14-4-5.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "LGRuntime.h"
#import <objc/message.h>

@implementation LGRuntime

+(id)performWithClassName:(NSString *)className selector:(SEL)sel
{
    id obj = nil;
    Class class = NSClassFromString(className);
    
    if (class)
    {
        obj = objc_msgSend(class, sel);
    }
    else
    {
        NSLog(@"Can't obtains CLASS from String [ %@ ]", className);
    }
    
    return obj;
}

+(void)performWithTarget:(id)target selector:(SEL)sel
{
    if ([target respondsToSelector:sel])
    {
        objc_msgSend(target, sel);
    }
    else
    {
        NSLog(@"[ %@ ] can't response to selector [ %@ ]", target, NSStringFromSelector(sel));
    }
}

@end
